target = test
srcs = shm.cpp 
libs = log/lib/liblog.a
subdirs = log
INCLUDE = -Ilog/include/  -I./
LIBRARY = -lpthread -lrt
CPPFLAGS += -g #-fpic 

objs=$(patsubst %.cpp, %.o, $(srcs))

all = $(target)

$(target) : $(objs)
	for dir in $(subdirs); do make -C $$dir ; done
#g++ $(CPPFLAGS) $(INCLUDE) -o $(target) $^ $(libs) $(LIBRARY)
	make -f reader.mk
	make -f writer.mk

%.o : %.cpp 
	g++ $(INCLUDE) $(CPPFLAGS) $< -c -o $@

.PHONY : clean
clean:
	rm -f *.o
	rm -f $(target)
	make clean -f reader.mk
	make clean -f writer.mk
#for dir in $(subdirs); do make -C $$dir clean; done

